#ifndef __SQL_LOOP_H__
#define __SQL_LOOP_H__

#include "sqliteCommon.h"
#include "CxlUtil.h"
#include "uv.h"
#include "pending_data_queue.h"
#include "pal/vzResultParse.h"
#include "hal/imx6/src/hal_gps_uv.h"

#define SQL_CMD_TYPE_ADD 'a'
#define SQL_CMD_TYPE_DEL 'd'
#define SQL_CMD_TYPE_UPDATE 'u'
// #define SQL_CMD_TYPE_SELECT 's'

#define SQL_CMD_UPDATE_DELETE_COL 'd'
#define SQL_CMD_UPDATE_UPLOAD_COL 'u'

typedef struct
{
    /**
     * 'a' 增
     * 'd' 删
     * 'u' 改
     * 's' 查
    */
    uint8_t cmdType;
    /**
     * 'd' 更新删除字段为true
     * 'u' 更新是否上传字段为true
    */
    uint8_t updateType;
    uint8_t camId;
    uint8_t fileNo;
    uint8_t licese[TH_LP_LEN];
    uint8_t shotTimeBcd[BCD_TIME_LENGTH];
    uint8_t picName[PIC_FILENAME_MAX_LEN];
    uint8_t picType;
    gps_t gps;
} SqlAsyncCmd;

void startSqlLoop();
void dispatchSqlCmdExec();
void dispatchSpeedEvent(bool isSpeedLow);
void setRecvResponseTrue();

bool is_sql_function_init();

#endif